package com.stockz.ui.swing.widget;

import java.awt.Dimension;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.KeyStroke;

import com.stockz.ui.resource.image.ImageIconLoader;
import com.stockz.ui.swing.charting.util.SwingUtil;


public class JMenuItem extends javax.swing.JMenuItem {
	private static final long serialVersionUID = -7777150926726897208L;
	private static final Dimension dimension = new Dimension(150,SwingUtil.mediumFont.getSize()+10);
	
	private Object payload;
	
	private void init(){
		setFont(SwingUtil.mediumFont);
		setPreferredSize(dimension);
	}
	
	public JMenuItem() {
		super();
		init();
	}

	public JMenuItem(Action a) {
		super(a);
		init();
	}

	public JMenuItem(Icon icon) {
		super(icon);
		init();
	}

	public JMenuItem(String text, Icon icon) {
		super(text, icon);
		init();
	}

	public JMenuItem(String text, int mnemonic) {
		super(text, mnemonic);
		init();
	}

	public JMenuItem(String text) {
		super(text);
		init();
	}

	public JMenuItem(String text, int mnemonic, int accelarator, String iconPath){
		this(text);
		setMnemonic(mnemonic);
		setAccelerator(KeyStroke.getKeyStroke(mnemonic, accelarator, true));
		setIcon(ImageIconLoader.loadImageIcon(iconPath));
	}
	
	public Object getPayload() {
		return payload;
	}

	public void setPayload(Object payload) {
		this.payload = payload;
	}

}
